package com.mcx.modules.common;

public class SecurityUtil {
    private static final byte[] xorScale = new byte[] { 45, 66, 38, 55, 23, (byte) 254, 9, (byte)165, 90, 19, 41, 45, (byte)201, 58, 55, 37, (byte)254, (byte)185, (byte)165, (byte)169, 19, (byte)171 };//.data文件的xor加解密因子

    public static byte[] Xor(byte[] buffer)
    {
        int iScaleLen = xorScale.length;
        for (int i = 0; i < buffer.length; i++)
        {
            buffer[i] = (byte)(buffer[i] ^ xorScale[i % iScaleLen]);
        }
        return buffer;
    }
}
